Conversation
evalfile support args
kastiglione
reviewed
Oct 27, 2018
|
|
||
| ret = fb.evaluate(source) | ||
| # if ret is not an address then print it directly | ||
| if ret[0:2] != '0x': |
Contributor
There was a problem hiding this comment.
you could do not ret.startswith('0x')
kastiglione
reviewed
Oct 27, 2018
| print ret | ||
| else: | ||
| command = 'po {}'.format(ret) | ||
| lldb.debugger.HandleCommand(command) |
Contributor
There was a problem hiding this comment.
you could do print fb.evaluateExpressionValue(ret).GetObjectDescription()
kastiglione
reviewed
Oct 27, 2018
| ret = process.ReadCStringFromMemory(int(ret.GetValue(), 16), 2**20, error) | ||
| if not error.Success(): | ||
| print error | ||
| return None |
Contributor
There was a problem hiding this comment.
what are these changes about?
Contributor
|
Thanks for the pull request. I did something similar recently, but without the arguments. Have you tried wrapping the code in a function? Or alternatively, a class method or a category? For example: @import ObjectiveC.runtime;
@implementation NSObject (ObjectProperties)
+ (NSArray *)propertyNames {
NSMutableArray *result = (id)[NSMutableArray array];
unsigned int count;
objc_property_t *props = (objc_property_t *)class_copyPropertyList(self, &count);
for (int i = 0; i < count; i++) {
char *name = (char *)property_getName(props[i]);
[result addObject:(id)[NSString stringWithUTF8String:name]];
}
return result;
}
@endAnd then from lldb: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
evalfile command can evaluate a multiline source code from a file. You can also supply a argument after the file parameter.